home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / programs / documentation / lightwave / sdk / include / lwmod.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-05  |  8.2 KB  |  259 lines

  1. /*
  2.  * LWSDK Header File
  3.  * Copyright 1995  NewTek, Inc.
  4.  */
  5. #ifndef LW_MOD_H
  6. #define LW_MOD_H
  7.  
  8. #include <lwbase.h>
  9.  
  10. typedef int             DynaType;
  11. #define DY_NULL         0
  12. #define DY_STRING       1
  13. #define DY_INTEGER      2
  14. #define DY_FLOAT        3
  15. #define DY_DISTANCE     4
  16. #define DY_VINT         5
  17. #define DY_VFLOAT       6
  18. #define DY_VDIST        7
  19. #define DY_BOOLEAN      8
  20. #define DY_CHOICE       9
  21. #define DY_SURFACE      10
  22. #define DY_FONT         11
  23. #define DY_TEXT         12
  24. #define DY_LAYERS       13
  25. #define DY_CUSTOM       14
  26. #define DY__LAST        DY_CUSTOM
  27. typedef int              EltOpLayer;
  28. #define OPLYR_PRIMARY    0
  29. #define OPLYR_FG         1
  30. #define OPLYR_BG         2
  31. #define OPLYR_SELECT     3
  32. #define OPLYR_ALL        4
  33. #define OPLYR_EMPTY      5
  34. #define OPLYR_NONEMPTY   6
  35. typedef int              EltOpSelect;
  36. #define OPSEL_GLOBAL     0
  37. #define OPSEL_USER       1
  38. #define OPSEL_DIRECT     2
  39. typedef struct st_Vertex        *PntID;
  40. typedef struct st_Polygon       *PolID;
  41. typedef struct st_EditState     *EditStateRef;
  42. typedef struct st_PointInfo {
  43.     PntID            pnt;
  44.     void            *userData;
  45.     int              layer;
  46.     int              flags;
  47.     double           position[3];
  48. } PointInfo;
  49. typedef struct st_PolygonInfo {
  50.     PolID            pol;
  51.     void            *userData;
  52.     int              layer;
  53.     int              flags;
  54.     int              numPnts;
  55.     const PntID     *points;
  56.     const char      *surface;
  57. } PolygonInfo;
  58. typedef int             EDError;
  59. #define EDERR_NONE      0
  60. #define EDERR_NOMEMORY  1
  61. #define EDERR_BADLAYER  2
  62. #define EDERR_BADSURF   3
  63. #define EDERR_USERABORT 4
  64. #define EDERR_BADARGS   5
  65. typedef EDError         PointScanFunc (void *, const PointInfo *);
  66. typedef EDError         PolyScanFunc (void *, const PolygonInfo *);
  67. typedef struct st_PBoundCv {
  68.     PolID            curve;
  69.     int              start, end;
  70. } PBoundCv;
  71. typedef struct st_DyValString {
  72.     DynaType         type;
  73.     char            *buf;
  74.     int              bufLen;
  75. } DyValString;
  76. typedef struct st_DyValInt {
  77.     DynaType         type;
  78.     int              value;
  79.     int              defVal;
  80. } DyValInt;
  81. typedef struct st_DyValFloat {
  82.     DynaType         type;
  83.     double           value;
  84.     double           defVal;
  85. } DyValFloat;
  86. typedef struct st_DyValIVector {
  87.     DynaType         type;
  88.     int              val[3];
  89.     int              defVal;
  90. } DyValIVector;
  91. typedef struct st_DyValFVector {
  92.     DynaType         type;
  93.     double           val[3];
  94.     double           defVal;
  95. } DyValFVector;
  96. typedef struct st_DyValCustom {
  97.     DynaType         type;
  98.     int              val[4];
  99. } DyValCustom;
  100. typedef union un_DynaValue {
  101.     DynaType         type;
  102.     DyValString      str;
  103.     DyValInt         intv;
  104.     DyValFloat       flt;
  105.     DyValIVector     ivec;
  106.     DyValFVector     fvec;
  107.     DyValCustom      cust;
  108. } DynaValue;
  109. #define DYERR_NONE                0
  110. #define DYERR_MEMORY            (-1)
  111. #define DYERR_BADTYPE           (-2)
  112. #define DYERR_BADSEQ            (-3)
  113. #define DYERR_BADCTRLID         (-4)
  114. #define DYERR_TOOMANYCTRL       (-5)
  115. #define DYERR_INTERNAL          (-6)
  116. #define PPDF_SELECT     (1<<0)
  117. #define PPDF_DELETE     (1<<1)
  118. #define PPDF_CCEND      (1<<2)
  119. #define PPDF_CCSTART    (1<<3)
  120. #define PPDF_CURVE      (1<<4)
  121. #define PPDF_DETAIL     (1<<5)
  122. typedef struct st_MeshEditOp {
  123.     EditStateRef      state;
  124.     int               layerNum;
  125.     void            (*done) (EditStateRef, EDError, int selm);
  126.  
  127.     int             (*pointCount) (EditStateRef, EltOpLayer, int mode);
  128.     int             (*polyCount)  (EditStateRef, EltOpLayer, int mode);
  129.     EDError         (*pointScan) (EditStateRef, PointScanFunc *,
  130.                       void *, EltOpLayer);
  131.     EDError         (*polyScan)  (EditStateRef, PolyScanFunc *,
  132.                       void *, EltOpLayer);
  133.     PointInfo *     (*pointInfo)  (EditStateRef, PntID);
  134.     PolygonInfo *   (*polyInfo)   (EditStateRef, PolID);
  135.     int             (*polyNormal) (EditStateRef, PolID, double[3]);
  136.     PntID           (*addPoint) (EditStateRef, double *xyz);
  137.     PolID           (*addPoly)  (EditStateRef, const char *surf,
  138.                      int numPnt, const PntID *);
  139.     PolID           (*addCurve) (EditStateRef, const char *surf,
  140.                      int numPnt, const PntID *, int flags);
  141.     EDError         (*addQuad)  (EditStateRef, PntID, PntID,
  142.                      PntID, PntID);
  143.     EDError         (*addTri)   (EditStateRef, PntID, PntID, PntID);
  144.     EDError         (*addPatch) (EditStateRef, int nr, int nc, int lr,
  145.                      int lc, PBoundCv *r0, PBoundCv *r1,
  146.                      PBoundCv *c0, PBoundCv *c1);
  147.     EDError         (*remPoint) (EditStateRef, PntID);
  148.     EDError         (*remPoly)  (EditStateRef, PolID);
  149.     EDError         (*pntMove) (EditStateRef, PntID, const double *);
  150.     EDError         (*polSurf) (EditStateRef, PolID, const char *);
  151.     EDError         (*polPnts) (EditStateRef, PolID, int, const PntID *);
  152.     EDError         (*polFlag) (EditStateRef, PolID, int mask, int value);
  153. } MeshEditOp;
  154. #define EDSELM_CLEARCURRENT     (1<<0)
  155. #define EDSELM_SELECTNEW        (1<<1)
  156. #ifndef LW_PRERELEASE
  157.  #define EDSELM_FORCEVRTS       (1<<2)
  158.  #define EDSELM_FORCEPOLS       (1<<3)
  159. #endif
  160. #define EDCOUNT_ALL              0
  161. #define EDCOUNT_SELECT           1
  162. #define EDCOUNT_DELETE           2
  163. typedef int             CommandCode;
  164. typedef struct st_DyChoiceHint {
  165.     const char      *item;
  166.     int              value;
  167. } DyChoiceHint;
  168.  
  169. typedef struct st_DyBitfieldHint {
  170.     char             code;
  171.     int              bitval;
  172. } DyBitfieldHint;
  173. typedef struct st_DynaStringHint {
  174.     DyChoiceHint    *chc;
  175.     DyBitfieldHint  *bits;
  176. } DynaStringHint;
  177. typedef struct st_DynaRequest   *DynaRequestID;
  178. typedef struct st_DyReqStringDesc {
  179.     DynaType         type;
  180.     int              width;
  181. } DyReqStringDesc;
  182. typedef struct st_DyReqChoiceDesc {
  183.     DynaType         type;
  184.     const char     **items;
  185.     int              vertical;
  186. } DyReqChoiceDesc;
  187. typedef struct st_DyReqTextDesc {
  188.     DynaType         type;
  189.     const char     **text;
  190. } DyReqTextDesc;
  191. typedef union un_DyReqControlDesc {
  192.     DynaType         type;
  193.     DyReqStringDesc  string;
  194.     DyReqChoiceDesc  choice;
  195.     DyReqTextDesc    text;
  196. } DyReqControlDesc;
  197. typedef MeshEditOp *    MeshEditBegin (int pntBuf, int polBuf,
  198.                     EltOpSelect);
  199. typedef struct st_ModCommand {
  200.     void             *data;
  201.     const char       *argument;
  202.     CommandCode     (*lookup)  (void *, const char *cmdName);
  203.     int             (*execute) (void *, CommandCode cmd,
  204.                     int argc, const DynaValue *argv,
  205.                     EltOpSelect, DynaValue *result);
  206.     MeshEditBegin    *editBegin;
  207. } ModCommand;
  208. typedef int             DynaConvertFunc (const DynaValue *,
  209.                      DynaValue *,
  210.                      const DynaStringHint *);
  211. typedef struct st_DynaReqFuncs {
  212.     DynaRequestID   (*create)   (const char *);
  213.     int             (*addCtrl)  (DynaRequestID, const char *,
  214.                      DyReqControlDesc *);
  215.     DynaType        (*ctrlType) (DynaRequestID, int);
  216.     int             (*valueSet) (DynaRequestID, int, DynaValue *);
  217.     int             (*valueGet) (DynaRequestID, int, DynaValue *);
  218.     int             (*post)     (DynaRequestID);
  219.     void            (*destroy)  (DynaRequestID);
  220. } DynaReqFuncs;
  221. typedef struct st_DynaMonitorFuncs {
  222.     Monitor *       (*create) (const char *, const char *);
  223.     void            (*destroy) (Monitor *);
  224. } DynaMonitorFuncs;
  225. typedef struct st_CustomCommandFuncs {
  226.     int             (*listAdd) (const char *name,
  227.                     const char *server,
  228.                     const char *arg);
  229.     void            (*listRem) (const char *name);
  230.     int             (*funGet) (int n, char *server,
  231.                    char *arg, int bufLen);
  232.     void            (*funSet) (int n, const char *server,
  233.                    const char *arg);
  234. } CustomCommandFuncs;
  235. typedef struct st_StateQueryFuncs {
  236.     int             (*numLayers) (void);
  237.     unsigned int    (*layerMask) (EltOpLayer);
  238.     const char *    (*surface) (void);
  239.     unsigned int    (*bbox) (EltOpLayer, double *minmax);
  240. } StateQueryFuncs;
  241. typedef struct st_SurfaceListFuncs {
  242.     const char *    (*next)    (const char *name);
  243.     void            (*create)  (const char *name);
  244.     void            (*rename)  (const char *name,
  245.                     const char *newName);
  246.     void *          (*getData) (const char *name, int *size);
  247.     void            (*setData) (const char *name, int size,
  248.                     void *data);
  249. } SurfaceListFuncs;
  250. typedef struct st_FontListFuncs {
  251.     int             (*count) (void);
  252.     int             (*index) (const char *name);
  253.     const char *    (*name)  (int index);
  254.     int             (*load)  (const char *filename);
  255.     void            (*clear) (int index);
  256. } FontListFuncs;
  257.  
  258. #endif
  259.